home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 47
/
Amiga Format AFCD47 (Issue 131, Xmas 1999).iso
/
+system+
/
afcdfind-handlematch.dopus5
< prev
next >
Wrap
Text File
|
1999-06-28
|
4KB
|
131 lines
/* $VER: AFCDFind-HandleMatch.dopus5 1.3 (23.6.99)
**
** Support script used by AFCDFind
**
** Usage: OpenLister.dopus5 pathname
** Looks in ENV:AFCDFind_DOpus for config options
**
** Author: Oliver Roberts
** E-Mail: oliver.roberts@iname.com
** WWW: http://www.nanunanu.org/~oliver/
*/
options results
options failat 21
/* DOpus running? */
If ~Show("P","DOPUS.1") Then Do
EXIT
End
Address "DOPUS.1"
/* Check for required lib */
if ~show('l', 'rexxsupport.library') then do
call addlib('rexxsupport.library', 0, -30, 0)
if ~show('l', 'rexxsupport.library') then do
dopus request '"This feature requires LIBS:rexxsupport.library" OK'
EXIT
end
end
/* Check version and exit if older than v5.5 */
dopus version
If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
dopus request '"This feature requires DOpus v5.5 or greater." OK'
EXIT
end
/* Parse in arguments and options in environment variable */
parse arg pathname
CALL GetEnv('AFCDFind_DOpus')
config = RESULT
parse var config . listermode
/* Turn AmigaDOS 'Insert Volume' requesters off */
pragma('W','N')
/* Determine if the correct CD is inserted, and if not, ask the user to
insert it */
volume = left(pathname,pos(':',pathname))
DO UNTIL (correctcd = 0 | exists(volume))
correctcd = 1;
If ~Exists(volume) Then Do
msg = "Please insert Amiga Format CD " || substr(volume,5,length(volume)-5)
dopus request '"'msg'" OK|Cancel'
correctcd = RC
end
end
/* Do the action if requested CD is available */
if (correctcd = 1 & exists(volume)) then do
stat = statef(pathname)
if (WORD(stat,1) = 'DIR') then do
/* Drawer button: Open the lister */
/* If drawer has no icon, make sure we are in showall mode */
drawericon = pathname
if (right(drawericon,1) = '/') then drawericon = left(drawericon,length(drawericon)-1)
drawericon = drawericon || '.info'
hasicon = 1
if (~exists(drawericon)) then do
if (find(listermode,'showall') == 0) then listermode = listermode 'showall'
hasicon = 0
end
dopus version
if (translate(result,'.',' ') < 5.8) then do
/* Open the lister the messy way - workaround for bug in DOpus */
lister new pathname
ourlister = RESULT
if (word(listermode,1) ~= 'name') then do
lister set ourlister mode listermode
end
end
else do
/* Open the list the clean way with DOpus 5.8 or higher */
if (hasicon == 1 & word(listermode,1) ~= 'name') then do
lister new mode listermode fromicon pathname
end
else do
lister new mode listermode pathname
end
end
end
else do
/* File button: get DOpus to act on file according to filetypes */
command doubleclick pathname
end
end
/* Finished */
EXIT
/* Procedure definitions */
/* GetEnv() return the value of an environmental variable */
GetEnv: procedure
/* Arguments: **
** arg(1) := The name of the variable to retrieve **
** Returns a string */
/* Use function from rexxarplib if it's available */
if show('L', 'rexxarplib.library') then
return 'GetEnv'(arg(1))
/* OPEN() will fail if variable is not defined. Null will be **
** returned in that case */
if open(6Env, 'env:'arg(1), 'R') then do
EnvVar = readln(6Env)
call close 6Env
end
else EnvVar = ''
return EnvVar